package whx.handler.adapter.impl;

import org.springframework.stereotype.Component;
import whx.handler.adapter.HandlerAdapter;

import javax.servlet.Servlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@Component
public class ServletHandlerAdapter implements HandlerAdapter {
    @Override
    public boolean support(Object handler) {
        return handler instanceof Servlet;
    }

    @Override
    public Object handler(HttpServletRequest req, HttpServletResponse resp, Object handler) throws Exception {
        ((Servlet)handler).service(req,resp);
        return null;
    }
}
